﻿using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using DG.Tweening;

public class OKButton : MonoBehaviour {

	Button btn;

	void Start () {

		btn = GetComponent<Button> ();
		btn.onClick.AddListener (delegate() {
			this.OnClick();	
		});

	}
	
	public void OnClick() {

		Sequence seq = DOTween.Sequence ();
		seq.Append (this.GetComponent<RectTransform> ().DOScale ( new Vector3(.5f, .5f, .5f ) , .25f ));
		seq.Append (this.GetComponent<RectTransform> ().DOScale ( new Vector3( 1f, 1f, 1f) , .25f ));
		seq.AppendInterval (.5f);

		seq.OnComplete (() => {
			// 截屏
			Application.CaptureScreenshot("Assets/Resources/Screen.png");

			// 进入 CreatePlayer Sence
			Application.LoadLevel("CreatePlayer");	
		});

	}

}
